home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / gui / muibuilder21.lha / MUIBuilder / MB / E / Localized_DemoGenCodeE30b / GUI.e < prev    next >
Encoding:
Text File  |  1994-10-14  |  6.0 KB  |  193 lines

  1. OPT MODULE
  2.  
  3.  
  4. ->*****
  5. ->** External modules
  6. ->*****
  7. MODULE 'muimaster' , 'libraries/mui'
  8. MODULE 'tools/boopsi'
  9. MODULE 'utility/tagitem' , 'utility/hooks'
  10.  
  11. MODULE '*Locale'
  12.  
  13.  
  14. ->*****
  15. ->** Object definitions
  16. ->*****
  17. EXPORT OBJECT app_arexx
  18.     commands :    PTR TO mui_command
  19.     error    :    hook
  20. ENDOBJECT
  21.  
  22. EXPORT OBJECT app_display
  23.     button_pressed          :    hook
  24. ENDOBJECT
  25.  
  26. EXPORT OBJECT app_obj
  27.     app                     :    PTR TO LONG
  28.     wi_the_window           :    PTR TO LONG
  29.     bt_put_constant_string  :    PTR TO LONG
  30.     bt_put_variable         :    PTR TO LONG
  31.     bt_return_id            :    PTR TO LONG
  32.     bt_call_hook            :    PTR TO LONG
  33.     tx_result               :    PTR TO LONG
  34.     bt_quit                 :    PTR TO LONG
  35.     stR_TX_result           :    PTR TO CHAR
  36. ENDOBJECT
  37.  
  38.  
  39. ->*****
  40. ->** Constant definitions
  41. ->*****
  42. EXPORT ENUM
  43.     ID_BUTTON_PRESSED = 1
  44.  
  45.  
  46. ->*****
  47. ->** Global variable definitions
  48. ->*****
  49. EXPORT DEF string_var
  50.  
  51. EXPORT DEF cat : PTR TO catalog_DemoGenCodeE
  52.  
  53.  
  54. /*************************************************************************
  55. ** Method to create one instance of one object or the whole application **
  56. *************************************************************************/
  57. PROC create( display : PTR TO app_display ,
  58.              icon  = NIL ,
  59.              arexx = NIL : PTR TO app_arexx ,
  60.              menu  = NIL ) OF app_obj
  61.  
  62.     DEF grOUP_ROOT_0C , gr_grp_0 , gr_grp_1 , la_result , gr_grp_2
  63.  
  64.     self.stR_TX_result           := cat.msg_TX_result.getstr()
  65.  
  66.     self.bt_put_constant_string := Mui_MakeObjectA(MUIO_Button,[ getMBstring( cat.msg_BT_put_constant_string.getstr() ) ])
  67.  
  68.     self.bt_put_variable := Mui_MakeObjectA(MUIO_Button,[ getMBstring( cat.msg_BT_put_variable.getstr() ) ])
  69.  
  70.     self.bt_return_id := Mui_MakeObjectA(MUIO_Button,[ getMBstring( cat.msg_BT_return_id.getstr() ) ])
  71.  
  72.     self.bt_call_hook := Mui_MakeObjectA(MUIO_Button,[ getMBstring( cat.msg_BT_call_hook.getstr() ) ])
  73.  
  74.     la_result := Mui_MakeObjectA(MUIO_Label,[ getMBstring( cat.msg_LA_result.getstr() ) ,0])
  75.  
  76.     self.tx_result := Mui_NewObjectA('Text.mui',[TAG_IGNORE,0 ,
  77.         MUIA_HelpNode , 'TX_result' ,
  78.         MUIA_Frame , MUIV_Frame_Text ,
  79.         MUIA_Text_Contents , self.stR_TX_result ,
  80.         MUIA_Text_SetMin , MUI_TRUE ,
  81.     TAG_DONE])
  82.  
  83.     gr_grp_1 := Mui_NewObjectA('Group.mui',[TAG_IGNORE,0 ,
  84.         MUIA_Group_Horiz , MUI_TRUE ,
  85.         MUIA_Group_Child , la_result ,
  86.         MUIA_Group_Child , self.tx_result ,
  87.     TAG_DONE])
  88.  
  89.     gr_grp_0 := Mui_NewObjectA('Group.mui',[TAG_IGNORE,0 ,
  90.         MUIA_Frame , MUIV_Frame_Group ,
  91.         MUIA_FrameTitle , getMBstring( cat.msg_GR_grp_0Title.getstr() ) ,
  92.         MUIA_Group_Child , self.bt_put_constant_string ,
  93.         MUIA_Group_Child , self.bt_put_variable ,
  94.         MUIA_Group_Child , self.bt_return_id ,
  95.         MUIA_Group_Child , self.bt_call_hook ,
  96.         MUIA_Group_Child , gr_grp_1 ,
  97.     TAG_DONE])
  98.  
  99.     self.bt_quit := Mui_MakeObjectA(MUIO_Button,[ getMBstring( cat.msg_BT_quit.getstr() ) ])
  100.  
  101.     gr_grp_2 := Mui_NewObjectA('Group.mui',[TAG_IGNORE,0 ,
  102.         MUIA_Group_Child , self.bt_quit ,
  103.     TAG_DONE])
  104.  
  105.     grOUP_ROOT_0C := Mui_NewObjectA('Group.mui',[TAG_IGNORE,0 ,
  106.         MUIA_Group_Child , gr_grp_0 ,
  107.         MUIA_Group_Child , gr_grp_2 ,
  108.     TAG_DONE])
  109.  
  110.     self.wi_the_window := Mui_NewObjectA('Window.mui',[TAG_IGNORE,0 ,
  111.         MUIA_Window_Title , getMBstring( cat.msg_WI_the_window.getstr() ) ,
  112.         MUIA_HelpNode , 'WI_the_window' ,
  113.         MUIA_Window_ID , "0WIN" ,
  114.         MUIA_Window_RootObject , grOUP_ROOT_0C ,
  115.     TAG_DONE])
  116.  
  117.     self.app := Mui_NewObjectA('Application.mui',[TAG_IGNORE,0 ,
  118.         ( IF icon THEN MUIA_Application_DiskObject ELSE TAG_IGNORE ) , icon ,
  119.         ( IF arexx.commands THEN MUIA_Application_Commands ELSE TAG_IGNORE ) , arexx.commands ,
  120.         ( IF arexx.error THEN MUIA_Application_RexxHook ELSE TAG_IGNORE ) , arexx.error ,
  121.         ( IF menu THEN MUIA_Application_Menu ELSE TAG_IGNORE ) , menu ,
  122.         MUIA_Application_Author , 'Lionel Vintenat' ,
  123.         MUIA_Application_Base , 'DEMOGENCODEE' ,
  124.         MUIA_Application_Title , 'DemoGenCodeE' ,
  125.         MUIA_Application_Version , '$VER: DemoGenCodeE 1.0 (01.09.94)' ,
  126.         MUIA_Application_Copyright , getMBstring( cat.msg_AppCopyright.getstr() ) ,
  127.         MUIA_Application_Description , getMBstring( cat.msg_AppDescription.getstr() ) ,
  128.         MUIA_Application_Window , self.wi_the_window ,
  129.     TAG_DONE])
  130.  
  131. ENDPROC self.app
  132.  
  133.  
  134. /**********************************************************
  135. ** Method to dispose the object or the whole application **
  136. **********************************************************/
  137. PROC dispose() OF app_obj IS Mui_DisposeObject( self.app )
  138.  
  139.  
  140. /*****************************************************************************************
  141. ** Method to initialize all the notifications of one object or of the whole application **
  142. *****************************************************************************************/
  143. PROC init_notifications( display : PTR TO app_display ) OF app_obj
  144.  
  145.     domethod( self.bt_put_constant_string , [
  146.         MUIM_Notify , MUIA_Pressed , FALSE ,
  147.         self.tx_result ,
  148.         3 ,
  149.         MUIM_Set , MUIA_Text_Contents , getMBstring( cat.msg_BT_put_constant_stringNotify0.getstr() ) ] )
  150.  
  151.     domethod( self.bt_put_variable , [
  152.         MUIM_Notify , MUIA_Pressed , FALSE ,
  153.         self.tx_result ,
  154.         3 ,
  155.         MUIM_Set , MUIA_Text_Contents , string_var ] )
  156.  
  157.     domethod( self.bt_return_id , [
  158.         MUIM_Notify , MUIA_Pressed , FALSE ,
  159.         self.app ,
  160.         2 ,
  161.         MUIM_Application_ReturnID , ID_BUTTON_PRESSED ] )
  162.  
  163.     domethod( self.bt_call_hook , [
  164.         MUIM_Notify , MUIA_Pressed , FALSE ,
  165.         self.app ,
  166.         2 ,
  167.         MUIM_CallHook , display.button_pressed ] )
  168.  
  169.     domethod( self.bt_quit , [
  170.         MUIM_Notify , MUIA_Pressed , FALSE ,
  171.         self.app ,
  172.         2 ,
  173.         MUIM_Application_ReturnID , MUIV_Application_ReturnID_Quit ] )
  174.  
  175.     domethod( self.wi_the_window , [
  176.         MUIM_Window_SetCycleChain , self.bt_put_constant_string ,
  177.         self.bt_put_variable ,
  178.         self.bt_return_id ,
  179.         self.bt_call_hook ,
  180.         self.tx_result ,
  181.         self.bt_quit ,
  182.         0 ] )
  183.  
  184.     SetAttrsA( self.wi_the_window ,[Eval(`(        MUIA_Window_Open )), MUI_TRUE ,TAG_DONE])
  185.  
  186. ENDPROC
  187.  
  188.  
  189. /***************************************************************
  190. ** Special GetString() function for MUIBuilder generated code **
  191. ***************************************************************/
  192. PROC getMBstring( local_string : PTR TO CHAR ) RETURN ( IF local_string[ 1 ] = "\0" THEN ( local_string + 2 ) ELSE local_string )
  193.